﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Generic;
using Model.WWW_User.UserComment;
using BLL.WWW_User.UserComment;

namespace BLF.WWW_User.UserComments
{
    /// <summary>
    /// UserComments 的摘要说明
    /// </summary>
    public class UserComments
    {
        /// <summary>
        /// 得到别人在我的小黑板上面的留言(0分页， 1留言信息和留言者信息，2留言记录数)
        /// </summary>
        /// <param name="memberNo">会员号</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>ArrayList长度为3包0分页， 1留言信息和留言者信息，2留言记录数</returns>
        public static ArrayList GetAllComments(string memberNo, int pageIndex, int pageSize)
        {
            int recordCount = 0;
            ArrayList returnValue = new ArrayList();
            UserCommentSystem cs = new UserCommentSystem();
            List<CommentModel> cmList = cs.GetAllComment(memberNo, pageIndex, pageSize, out recordCount);
            //List<CommentModel> cmm = GetCommentCollectionFromCommentModelCollection(cmList);
            returnValue.Add(new PageableObject(recordCount, pageIndex, pageSize));
            returnValue.Add(cmList.ToArray());
            returnValue.Add(recordCount);
            return returnValue;
        }

        /// <summary>
        /// 在小黑板上面留言
        /// </summary>
        /// <param name="userTo">留言者</param>
        /// <param name="userFrom">得到留言的人</param>
        /// <param name="content">留言内容</param>
        /// <returns>Bool</returns>
        public static bool AddComment(string userTo, string userFrom, string content)
        {
            UserCommentSystem cs = new UserCommentSystem();
            return cs.AddComment(userTo, userFrom, content);
        }

        public static bool DeleteComment(string id)
        {
            return (new UserCommentSystem()).DeleteComment(id);
        }

        /// <summary>
        /// 添加留言并获取小黑板列表
        /// 0：int 1有权限留言 0无（注当为1才有后面数据）
        /// 1：小黑板列表 CommentModel List
        /// 2：数量
        /// </summary>
        /// <param name="memberno">会员编号</param>
        /// <param name="myMemberno">我的编号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="content">留言内容</param>
        /// <returns>ArrayList</returns>
        public static ArrayList AddGetComment(string memberno, string myMemberno, int pageIndex, int pageSize, string content)
        {
            return new UserCommentSystem().AddGetComment(memberno, myMemberno, pageIndex, pageSize, content);
        }
        /// <summary>
        /// 删除留言并获取小黑板列表
        /// 0：小黑板列表 CommentModel List
        /// 1：数量
        /// </summary>
        /// <param name="memberno">会员编号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="id">留言id</param>
        /// <returns>ArrayList</returns>
        public static ArrayList DeleteGetComment(string memberno, int pageIndex, int pageSize, int id)
        {
            return new UserCommentSystem().DeleteGetComment(memberno, pageIndex, pageSize, id);
        }
    }
}
